Option Strict Off
Option Explicit On
Namespace BMLERP
	Friend Class FrmReceived
		Inherits System.Windows.Forms.Form


		Private Sub Command3_Click()
			Me.Close()
		End Sub

		Private Sub CmdAccept_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles CmdAccept.Click
			Dim Objcmd As ADODB.Command
			Objcmd = New ADODB.Command
			Objcmd.CommandText = "AutoReceiving"
			Objcmd.CommandType = ADODB.CommandTypeEnum.adCmdStoredProc

			' Connect to the data source.
			'Set objConn = GetNewConnection
			Objcmd.ActiveConnection = DBconn

			' Automatically fill in parameter info from stored procedure.
			Objcmd.Parameters.Refresh()

			' Set the param value.
			Objcmd.Parameters(1).Value = UserLogin
			Objcmd.Parameters(2).Value = DCmbDoNo.BoundText
			Objcmd.Parameters(3).Value = DCmbWhC.BoundText
			Objcmd.Parameters(4).Value = "1111"
			' Execute once and display...
			Objcmd.Execute()
			MsgBox("Success")
			DCmbDoNo.BoundText = ""
			Adodc1.Refresh()
		End Sub

		Private Sub DataCombo2_Click(ByRef Area As Short)

			Adodc2.Refresh()
		End Sub

		Private Sub cmdexit_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles CmdExit.Click
			Me.Close()
		End Sub

		Private Sub CmdPreview_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles CmdPreview.Click
			Dim ReportName As String

			ReportName = "receivereport.rpt"
			If DCmbDoNo.BoundText = "" Or IsDBNull(DCmbDoNo.BoundText) Then
				MsgBox("You must chose DocNo.")
				Exit Sub
			Else
				CrystalReport1.ReportFileName = DDAN & "\" & ReportName
				CrystalReport1.RetrieveStoredProcParams()
				CrystalReport1.set_StoredProcParam(0, DCmbDoNo.BoundText)
				CrystalReport1.Action = 1
			End If
		End Sub

		Private Sub OpenFile()
			Adodc1.ConnectionString = ConnectString
			Adodc1.ConnectionTimeout = 10
			Adodc1.CommandType = ADODB.CommandTypeEnum.adCmdText
			Adodc1.RecordSource = "SELECT DCDOC AS doc From IDC WHERE(DCPRT = 'N')"
			Adodc1.Refresh()
			Adodc2.ConnectionString = ConnectString
			Adodc2.ConnectionTimeout = 10
			Adodc2.CommandType = ADODB.CommandTypeEnum.adCmdTable
			Adodc2.RecordSource = "IWM"
			Adodc2.Refresh()
		End Sub

		Private Sub FrmReceived_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
			OpenFile()
			VB6_AddADODataBinding()
			DCmbDoNo.RowSource = ADOBind_Adodc1.DataSource
			DCmbWhC.RowSource = ADOBind_Adodc2.DataSource


		End Sub
	End Class
End Namespace